package com.tbit.uqbike.object.pojo;

import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.constant.CsvConstant;
import com.tbit.uqbike.webmanager.util.csv.annotations.Csv;
import com.tbit.uqbike.webmanager.util.csv.entity.DownloadDTO;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 * @Author HZW
 * @ClassName FeeAppeal
 * @Description 订单申诉实体类
 * @date 2021/12/20 11:34
 * @Version 1.0
 */
@Data
public class FeeAppeal extends DownloadDTO {

    private static final long serialVersionUID = 1L;

    /**
     * 申诉id
     */
    private Integer appealId;
    /**
     * 平台账户id
     */
    private Integer accountId;
    /**
     * 用户id
     */
    private Integer userId;
    /**
     * 骑行订单号
     */
    @Csv(name = "订单编号", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "订单编号", sort = 1)
    private String orderNO;
    /**
     * 申诉类型
     */
    @Csv(name = "问题类型", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "问题类型", sort = 4)
    private String type;
    /**
     * 图片url地址
     */
    private String url;
    /**
     * 设备编号
     */
    @Csv(name = "设备编号", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "设备编号", sort = 2)
    private String machineNO;
    /**
     * 订单金额
     */
    @Csv(name = "订单金额", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "订单金额", sort = 12)
    private Double money;
    /**
     * 备注（客户申诉备注）
     */
    @Csv(name = "描述", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "描述", sort = 5)
    private String remark;
    /**
     * 申诉时间
     */
    @Csv(name = "提交时间", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "提交时间", sort = 11)
    private String addTime;
    /**
     * 处理时间
     */
    @Csv(name = "处理时间", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "处理时间", sort = 10)
    private String handleTime;
    /**
     * 客服处理回复
     */
    @Csv(name = "回复", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "回复", sort = 9)
    @Size(max = 235, message = "回复长度不能超过235个汉字")
    private String result;
    /**
     * 处理状态：null（为空），该笔骑行订单没有申诉；0:处理中；1:申诉驳回；2:申诉通过
     */
    @NotNull(message = "处理结果不能为空")
    private Integer state;
    /**
     * 补偿方案id,0:退款到用户钱包，1：退款虚拟金额，2：其他方案补偿 3:新增原路退还 4:礼品卡
     */
    private Integer compensationId;
    /**
     * 是否发送短信，0不发送，1发送
     */
    @NotNull(message = "消息推送开关不为空")
    private Integer isSend;
    /**
     * 开始时间
     */
//    private String startTime;
    /**
     * 结束时间
     */
//    private String endTime;
    /**
     * 用户号码
     */
    @Csv(name = "联系方式", type = CsvConstant.CSV_TYPE_WITHOUT)
    @NotNull
    @Excel(name = "联系方式", sort = 6)
    private String phone;
    /**
     * 密钥
     */
    private String operaPsw;

    /**
     * 处理进度
     */
    @Csv(name = "处理进度", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "处理进度", sort = 7)
    private String handlePlan;

    /**
     * 处理结果
     */
    @Csv(name = "处理结果", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "处理结果", sort = 8)
    private String handleResult;

    /**
     * 费用明细列
     */
    private String rideRemark;
    /**
     * 罚款费用(单位：分)
     */
    private Long fineMoney;
    /**
     * 退款金额(单位：分)
     */
    private Long refundMoney;

    /**
     * 礼品卡金额(单位：分)
     */
    private Long giftMoney;

    private Integer machineId;

    @Csv(name = "车辆编号", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "车辆编号", sort = 3)
    private String userCode;
    /**
     * 当前订单已退金额
     */
    @Csv(name = "已退款金额", type = CsvConstant.CSV_TYPE_WITHOUT)
    @Excel(name = "已退款金额", sort = 13)
    private Double refundedMoney;

    /**
     * 退款状态(0 退款中)
     */
    private Integer refundStatus;

    /**
     * 区域id集合
     */
    private List<Integer> accountIds;

    /**
     * 区域名称
     */
    private String accountName;

    /**
     * 起始查询id
     * */
    private Integer startId;
    /**
     * 结束查询id
     * */
    private Integer endId;

    /**
     * 每页的数量
     * */
    private Integer pageSize;


    private Date dealTime;

    /**
     * 创建时间
     */
    private Date createTime;

    //总数
    private int count;



    /**
     * 去除特殊字符串
     * 特殊字符串会导致前端页面报错
     */
    public void removeSpecialCharacters() {
        if (StringUtils.isBlank(this.remark)) {
            return;
        }
        this.remark = this.remark.replace("^", "").replace("$", "").replace("\"", "").replace("'", "");
    }

}
